﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hydra.UrlMon.Implementation;
using Hydra.UrlMon.Enumerations;
using Hydra.Shell.Attributes;

namespace Hydra.UrlMon.Interfaces
{
    [Guid("9AF93CAB-B449-442A-97EC-1B63C2E852E3")]
    public interface IInternetProtocolRoot
    {
        /// <summary>Starts the operation. </summary>
        /// <remarks>URL Moniker Error Codes can be returned only by a pluggable namespace handler or MIME filter. Only a single, permanently registered asynchronous pluggable protocol handler can be assigned to a particular scheme (such as FTP), so there are no other handlers to default to.</remarks>
        /// <param name="szUrl">
        /// Address of a string value that contains the URL. For a pluggable MIME filter, this parameter contains the MIME type.</param>
        /// <param name="pOIProtSink">
        /// Address of the protocol sink provided by the client.</param>
        /// <param name="pOIBindInfo">
        /// Address of the IInternetBindInfo interface from which the protocol gets download-specific information.</param>
        /// <param name="grfPI">
        /// Unsigned long integer value that contains the flags that determine if the method only parses or if it parses and downloads the URL. This can be one of the PI_FLAGS values.</param>
        /// <param name="dwReserved">
        /// For pluggable MIME filters, contains the address of a PROTOCOLFILTERDATA structure. Otherwise, it is reserved and must be set to NULL.</param>
        void Start(string szUrl, IInternetProtocolSink pOIProtSink, IInternetBindInfo pOIBindInfo, ProtocolFlags grfPI, int dwReserved);

        /// <summary>Allows the pluggable protocol handler to continue processing data on the apartment thread. </summary>
        /// <remarks>This method is called in response to a call to the IInternetProtocolSink::Switch method. </remarks>
        /// <param name="pProtocolData">
        /// Address of the PROTOCOLDATA structure data passed to IInternetProtocolSink::Switch.</param>
        void Continue(ref ProtocolData pProtocolData);

        /// <summary>Cancels an operation that is in progress. </summary>
        /// <param name="hrReason">
        /// HRESULT value that contains the reason for canceling the operation. This is the HRESULT that is reported by the pluggable protocol if it successfully canceled the binding. The pluggable protocol passes this HRESULT to urlmon.dll using the IInternetProtocolSink::ReportResult method. Urlmon.dll then passes this HRESULT to the host using IBindStatusCallback::OnStopBinding.</param>
        /// <param name="dwOptions">
        /// Reserved. Must be set to 0.</param>
        void Abort(int hrReason, int dwOptions);

        /// <summary>Releases the resources used by the pluggable protocol handler. </summary>
        /// <remarks>Note to implementers
        /// Urlmon.dll will not call this method until your asynchronous pluggable protocol handler calls the Urlmon.dll IInternetProtocolSink::ReportResult method. When your IInternetProtocolRoot::Terminate method is called, your asynchronous pluggable protocol handler should free all resources it has allocated.
        /// Note to callers
        /// This method should be called after receiving a call to your IInternetProtocolSink::ReportResult method and after the protocol handler's IInternetProtocol::LockRequest method has been called. </remarks>
        /// <param name="dwOptions">
        /// Reserved. Must be set to 0.</param>
        void Terminate(int dwOptions);

        /// <summary>Not currently implemented.</summary>
        void Suspend();

        /// <summary>Not currently implemented. </summary>
        void Resume();
    }
}
